######################################################################
# Time-stamp: <05/08/09 16:57:19 ostolop>
#
# Package: EP::Core::Dataset::Data::Factory
#
# The Dataset::Data Factory class
######################################################################
package EP::Core::Dataset::Data::Factory;

use strict;

use EP::Common;
use EP::Common::Error qw ( :try );

#use Module::Locate qw/locate/;

# sub: create_dataset_data
#   Instantiates a new dataset data object
# parameters:
#   data_type     - The type of data to be parsed (one of exp, seq, ppi)
#   owner_dataset - The owner dataset object reference.
# returns:
#    A new instance of an appropriate subclass of <EP::Core::Dataset::Data>.
sub create_dataset_data {
  my $class = shift;
  my %params = @_;

  my $data = "EP::Core::Dataset::Data::" . $params{data_type};

  try {
    $data->require;
    return $data->new ( %params );
  } otherwise {
    throw EP::Common::Error ( -value => CUD_PARSER_LOAD_FAILURE );
  };
}

1;
